Skip to content

feat(output): replace home directory with ~ in printed paths #1730

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

n0ta26
Copy link

@n0ta26 n0ta26 commented May 29, 2025

Summary

This pull request adds support for replacing the absolute home directory path
with ~ in printed file paths, as suggested in issue #1688.

Details

  • Modified print_entry_uncolorized_base, print_entry_colorized, and other output functions to use replace_home_dir.
  • Ensured that this replacement works with --color=always, --color=never, and path separator options.
  • Added an integration test to confirm that paths under $HOME are displayed with ~.

Related Issue

Fixes #1688

n0ta26 added 2 commits May 30, 2025 00:40
This change replaces the absolute home directory path with `~` when printing
file paths to the output, making the output more readable and concise.

Fixes sharkdp#1688
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support ~ in results (for --color)
1 participant